#!/bin/bash
## kola:
##  # This test only runs on FCOS because `systemd-resolved` is not installed on
##  # RHCOS
##   distros:  fcos
##   exclusive: false
##   description: Verify systemd-resolved and the stub listener
##     should be enabled by default.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

if ! systemctl is-enabled systemd-resolved 1>/dev/null; then
    fatal "Unit systemd-resolved should be enabled"
fi

# systemd-resolved should be fully functional on f35+
if ! grep 'nameserver 127.0.0.53' /etc/resolv.conf; then
    fatal "systemd-resolved stub listener isn't enabled"
fi
ok "systemd-resolved is enabled and the stub listener is enabled"
